#include "CE.h"
#include "CE_Scene.h"

USING_NS_CC;

CE_Scene::CE_Scene(void)
{
	m_scene = NULL;
	m_startScene = false;
}


CE_Scene::~CE_Scene(void)
{
}

Scene* CE_Scene::scene()
{
	m_scene = Scene::create();
	Layer* layer = Layer::create();
	m_scene->addChild(layer);

	Point origin = Director::getInstance()->getVisibleOrigin();
    Size visibleSize = Director::getInstance()->getVisibleSize();
	LabelTTF* label = LabelTTF::create(m_sceneName.c_str(), "Arial", 
		cocos2d::EGLView::getInstance()->getDesignResolutionSize().width / 480 * 24);
    
    // position the label on the center of the screen
    label->setPosition(Point(origin.x + visibleSize.width/2,100));

    // add the label as a child to this layer
	layer->addChild(label, 1);

	return m_scene;
}

void CE_Scene::setCurrentScene()
{
	if( Director::getInstance()->getRunningScene() )
		Director::getInstance()->replaceScene(scene());
	else
		Director::getInstance()->runWithScene(scene());
}
